load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "scheduler",
    srcs = [
        "interface.go",
        "interface_mock.go",
        "manager.go",
        "register.go",
        "scheduler.go",
    ],
    importpath = "github.com/pingcap/tidb/disttask/framework/scheduler",
    visibility = ["//visibility:public"],
    deps = [
        "//disttask/framework/proto",
        "//disttask/framework/storage",
        "//resourcemanager/pool/spool",
        "//resourcemanager/util",
        "//util/logutil",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_stretchr_testify//mock",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "scheduler_test",
    timeout = "short",
    srcs = [
        "manager_test.go",
        "register_test.go",
        "scheduler_test.go",
    ],
    embed = [":scheduler"],
    flaky = True,
    race = "on",
    shard_count = 9,
    deps = [
        "//disttask/framework/proto",
        "//resourcemanager/pool/spool",
        "//resourcemanager/util",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pkg_errors//:errors",
        "@com_github_stretchr_testify//mock",
        "@com_github_stretchr_testify//require",
    ],
)
